package com.shuker.design.abstarct.factory.impl;

import com.shuker.design.abstarct.factory.ICacheAdapter;
import com.shuker.design.abstarct.factory.matter.EGM;

import java.util.concurrent.TimeUnit;

/**
 * @author ：Shuker
 * @date ：Created in 2022/1/11 17:13
 * @description：EGM集群适配器
 * @version: 1.0
 */
public class EGMCacheAdapter implements ICacheAdapter {

    private EGM egm = new EGM();

    @Override
    public String get(String key) {
        return egm.gain(key);
    }

    @Override
    public void set(String key, String value) {
        egm.set(key,value);
    }

    @Override
    public void set(String key, String value, long timeout, TimeUnit timeUnit) {
        egm.setEx(key,value,timeout,timeUnit);
    }

    @Override
    public void del(String key) {
        egm.delete(key);
    }
}
